#include<iostream>
#include<string>
#include<gtest/gtest.h>
#include<unordered_map>


std::unordered_map<std::string,std::string> dirt;

class Mydirt:public testing::Environment
{
    public:
        virtual void SetUp() override
        {
            std::cout<<"测试前执行"<<std::endl;
            dirt.insert(std::make_pair("Apple","苹果"));
        }

        virtual void TearDown() override
        {
            std::cout<<"全部测试单元结束,清理工作!"<<std::endl;
            dirt.clear();
        }
};

TEST(hash_case_test,find_word)
{
    auto it=dirt.find("Apple");
    //ASSERT_EQ(it,dirt.end())<<"找到了!";   //断言失败,这一行不执行
    EXPECT_EQ(it,dirt.end());
    dirt.insert(std::make_pair("word","单词"));
}
TEST(hash_case_test2,size)
{
    EXPECT_EQ(2,dirt.size());
    EXPECT_GT(3,dirt.size());
}

int main(int argc,char*argv[])
{   
    testing::AddGlobalTestEnvironment(new Mydirt);
    testing::InitGoogleTest(&argc,argv);
    RUN_ALL_TESTS();
    return 0;
}

